<?php

if ( !defined('MMVCPATH') )
	define( 'MMVCPATH', dirname(dirname(__FILE__)).'/inc/' );
if ( !defined('DEBUG_LOG') )
	define( 'DEBUG_LOG', dirname(dirname(__FILE__)).'/mmvc.log' );
require_once( MMVCPATH.'dbg_util.php' );

/**
 * Checks that assumption is valid. Prints optional error message and stack and exit(1) if not.
 */
function check( $cond, $msg='' ) {
	if ( !$cond ) {
		$trace = formatTrace();
		if ( is_object($msg) ) {
			$trace = $msg->getTraceAsString();
			$msg = $msg->getMessage();
		}
		echo date('Y-m-d H:i:s')." ERROR: ".preg_replace('/\s/',' ',$msg)."\n$trace\n";
		exit(1);
	}
}

?>